﻿using System;
using Core;
using System.IO;
using UnityEditor;
using UnityEngine;

public class FindGuid
{
    [MenuItem("Assets/Mini Tools/Meta/查找GUID所属meta", false)]
    public static void Main()
    {
        var tgt_guid = "6295099bdce4e3c499cab2f2617ba164";

        var files = Utils.File.GetFiles(Application.dataPath);
        files.RemoveAll(c => !c.EndsWith(".meta"));
        Debug.Log(files.Count);

        foreach (var file in files)
        {
            var lines = File.ReadAllLines(file);
            for (var i = 0; i < lines.Length; i++)
            {
                var line = lines[i];
                
                if (line.IndexOf(tgt_guid, StringComparison.Ordinal) < 0) continue;

                Debug.Log($"file:{file} contains {tgt_guid}");
                break;
            }
        }

    }
}
